﻿@{
    ViewBag.Title = Local("ImageView.PageTitle");
    Layout = GetPath(SystemDirectory.Shared, "_Dialog.cshtml");
}

@model UserFile

@if (IsValided)
{
    using (Html.BeginForm())
    {
    <div class="box">
        <label>@Local("UserFile.FileName")</label>
        <div class="right">
            @Html.TextBoxFor(model => model.FullName)
        </div>
    </div>
     
    <div class="box">
        <label>@Local("Folder.FolderName")</label>
        <div class="right">
            @Html.DropdownListFoldersFor(model => model.FolderID)
        </div>
    </div>
     
    <div class="box">
        <label>@Local("UserFile.ImageWidth")</label>
        <div class="right">
            <input onchange="setFileName();" id="ImageWidth" name="ImageWidth" type="text" /> 
        </div>
    </div>
     
    <div class="box">
        <label>@Local("UserFile.ImageHeight")</label>
        <div class="right">
            <input onchange="setFileName();" id="ImageHeight" name="ImageHeight" type="text" /> 
        </div>
    </div>
     
     <div class="box">
        <button class="submit">@Local("FolderView.Save")</button>
     </div>
    }
}

@section header
{
    <script type="text/javascript">
        function setFileName() {
            var width = $('#ImageWidth').val();
            var height = $('#ImageHeight').val();
            $('#FullName').val('@Model.FileName'+'_'+width+'x'+height+'.'+'@Model.Extension');
        }
    </script>
}
